package com.example.luohao.myrecyclerviewdemo;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {

    private Button mBT1;
    private Button mBT2;
    private Button mBT3;
    private Button mBT4;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        mBT1 = this.findViewById(R.id.mBT1);
        mBT2 = this.findViewById(R.id.mBT2);
        mBT3 = this.findViewById(R.id.mBT3);
        mBT4 = this.findViewById(R.id.mBT4);
        mBT1.setOnClickListener(this);
        mBT2.setOnClickListener(this);
        mBT3.setOnClickListener(this);
        mBT4.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        Intent intent = new Intent();
        switch (view.getId()) {
            case R.id.mBT1:
                startActivity(new Intent(this, Activity1.class));
                break;
            case R.id.mBT2:
                intent.setClass(this, Activity2.class);
                startActivity(intent);
                break;
            case R.id.mBT3:
                intent.setClass(MainActivity.this, Activity3.class);
                startActivity(intent);
                break;
            case R.id.mBT4:
                intent.setClass(MainActivity.this, Activity4.class);
                startActivity(intent);
                break;
        }
    }
}
